package org.example.controller;

import jakarta.annotation.Resource;
import org.example.bean.Alipay;
import org.example.service.AlipayService;
import org.example.util.JsonResult;
import org.example.util.ResultTool;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auther:Liu
 * @Testname:AlipayContrroller
 * @Date:2025/8/21 17:30
 */
@RestController
@RequestMapping("/alipay")
public class AlipayContrroller {
    @Resource
    private AlipayService alipayService;

    @PostMapping("/pay")
    public String pay(Alipay alipay) {
        return alipayService.pay(alipay);
    }

    @GetMapping("/success")
    public JsonResult success() {
        return ResultTool.success("支付成功");
    }

    @GetMapping("/refund")
    public JsonResult refund(Alipay alipay) {
        return ResultTool.success(alipayService.refund(alipay));
    }

    @GetMapping("/query")
    public JsonResult query(Alipay alipay) {
        return ResultTool.success(alipayService.query(alipay));
    }

}
